package com.codeoss.module.account.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.codeoss.framework.service.impl.BaseService;
import com.codeoss.module.account.dao.AccountPaymentMapper;
import com.codeoss.module.account.model.AccountPayment;
import com.codeoss.module.account.service.IAccountPaymentService;

@Service
public class AccountPaymentService extends BaseService<AccountPaymentMapper, AccountPayment>
		implements IAccountPaymentService {

	@Override
	@Transactional
	public void prepareIt(Long id) {
		// TODO Auto-generated method stub
		
	}

	@Override
	@Transactional
	public void approveIt(Long id) {
		// TODO Auto-generated method stub
		AccountPayment accountPayment=getById(id);
		accountPayment.setApproved(true);
		update(accountPayment);
	}

	@Override
	@Transactional
	public void rejectIt(Long id) {
		// TODO Auto-generated method stub
		AccountPayment accountPayment=getById(id);
		accountPayment.setApproved(false);
		update(accountPayment);
	}

	@Override
	@Transactional
	public void completeIt(Long id) {
		// TODO Auto-generated method stub
		AccountPayment accountPayment=getById(id);
		accountPayment.setDocStatus("CO");
		update(accountPayment);
	}

	@Override
	@Transactional
	public void setDocStatus(Long id, String docStatus) {
		// TODO Auto-generated method stub
		AccountPayment accountPayment=getById(id);
		accountPayment.setDocStatus(docStatus);
		update(accountPayment);
	}
}